package com.blt.car.me.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.blt.car.R;
import com.blt.car.base.IBaseAdapter;
import com.blt.car.utils.StringUtils;

import blt.app_core.api.journey.bean.AppealInfo;

/**
 * Created by xgp on 2017/7/12.
 */

public class RedAdapter extends IBaseAdapter {

    public RedAdapter(Context context, int resource) {
        super(context, resource);
    }

    @Override
    public View getYView(int i, View view, ViewGroup viewGroup) {
        TextView tvTitle = (TextView) view.findViewById(R.id.item_red_tv_title);
        TextView tvJourneyAmount = (TextView) view.findViewById(R.id.red_tv_journey_amount);
        TextView tvJourneyTime = (TextView) view.findViewById(R.id.red_tv_journey_time);
        AppealInfo appealInfo = (AppealInfo) list.get(i);

        tvJourneyAmount.setText(appealInfo.amount+"元");
        tvJourneyTime.setText(StringUtils.getDay(appealInfo.createTime));
        if (appealInfo.amount > 0) {
            tvTitle.setText("行程红包");
        } else {
            tvTitle.setText("红包提现");
            tvJourneyAmount.setText("0元");
        }


        return view;
    }
}
